{ Google Code Jam 2011. Qualification Round.
  Problemset: http://code.google.com/codejam/contest/dashboard?c=975485#
  Problem D
  Verdict: Correct/Correct
}
var 
	i,j,n,t,k:longint;
	r:double;
begin
reset(input,'input.txt');
rewrite(output,'output.txt');
read(t);
for i:=1 to t do begin
	read(n);
	r:=n;
	for j:=1 to n do begin
		read(k);
		if k=j then r:=r-1;
	end;
	writeln('Case #',i,': ',r:0:6);
end;
end.